#include "Course.h"
#include "DataRow.h"
#include "Subject_lib.h"
#include "Lecturer_lib.h"

#include <iomanip>

DataRow::DataRow(){
    stt = 0;
    subject = "";
    credits = 0;
    prequisite = "";
    lecturer = "";
    room = "";
    time = "";
}

DataRow::DataRow(Course c, int i_stt){
    string _c_id = c.getSubjectID();
    int _l_id = atoi(c.getLecturerID().c_str());

    stt = i_stt;

    subject = GetSubjectNameByID(_c_id, "subject.txt");
    credits = GetCreditsByID(_c_id, "subject.txt");
    prequisite = GetPresubByID(_c_id, "subject.txt");
    lecturer = GetLecturerNameByID(_l_id, "lecturer.txt");
    room = c.getRoom();
    time = c.getTime();
}

void DataRow::ToString(){
    cout << stt << setw(12) << subject << setw(5) << credits << setw(10) << prequisite << setw(10) << room << setw(20) << time << setw(20) << lecturer << "\n";
}
